package com.miyake.loveviewweb.server;

import java.util.List;

import org.slim3.datastore.Datastore;

import com.google.appengine.api.blobstore.BlobKey;
import com.google.appengine.api.datastore.Key;
import com.miyake.loveviewweb.server.meta.UploadedFileMeta;
import com.miyake.loveviewweb.shared.model.UploadedFile;

public class UploadFileService {
    private UploadedFileMeta meta = UploadedFileMeta.get();

    public Key entry(BlobKey blobKey) {
        UploadedFile uploadedFile = UploadedFile.getInstance(blobKey);
        uploadedFile.setKey(UploadedFile.createKey(blobKey));
        return Datastore.put(uploadedFile);
    }

    public List<UploadedFile> getUploadedFileList() {
        return Datastore.query(meta).asList();
    }

}
